package main

import "fmt"

func calc(a, b int, fn func(int, int) int) int {
	return fn(a, b)
}

// func outer() {
// 	c := 99
// 	var inner = func() {
// 		c = 100
// 		fmt.Println("1 inner:", c)
// 		c := 101
// 		fmt.Println("3 inner:", c)
// 	}
// 	inner()
// 	fmt.Println("2 outer:", c)
// }

func outer() func() {
	c := 99
	fmt.Printf("outer %d %p\n", c, &c)
	var inner = func() {
		fmt.Printf("inner %d %p\n", c, &c)
	}
	return inner
}

func main() {
	fmt.Println(calc(4, 5, func(a, b int) int { return a + b }))
	fmt.Println(calc(4, 5, func(A, b int) int { return A * b }))
	// outer()
	var fn = outer()
	fn()
}
